package com.duartepeixinho.P3D.Cameras 
{
	import com.duartepeixinho.P3D.Cameras.Camera;
	import com.duartepeixinho.P3D.Core.Math.Vector3;
	import com.duartepeixinho.P3D.Objects.DisplayObject3D;
	import com.duartepeixinho.P3D.Objects.Object3D;
	
	/**
	 * P3D
	 * @version 0.1
	 * @author Duarte Peixinho
	 */
	public class Camera extends Object3D
	{
		
		private var _up:Vector3 = new Vector3(0, 1, 0);
		private var _target:Object3D;
		
		public function Camera()
		{			
			super(this);			
			_target = DisplayObject3D.ZERO;
			this.position = new Vector3(0, 0, 1000);					
		}
			
		public function set target(target:Object3D):void {
			_target = target;
		}
		public function get target():Object3D {
			return _target;
		}
		
		override public function updateMatrix(camera:Camera = null):void 
		{
			lookAt(_target);
			super.updateMatrix(camera);
		}
		
	}

}